package com.zdb.service.impl;

import com.zdb.mapper.CategoriesMapper;
import com.zdb.pojo.Categorie;
import com.zdb.service.CategoriesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoriesServiceImpl implements CategoriesService {
    @Autowired
    private CategoriesMapper categoriesMapper;
    @Override
    public List<Categorie> list() {
        return    categoriesMapper.selectList(null);
    }

    @Override
    public Categorie getById(Integer id) {
       return categoriesMapper.selectById( id);
    }

    @Override
    public Integer removeById(Integer id) {
        return categoriesMapper.deleteById( id);
    }

    @Override
    public Integer add(Categorie categorie) {
        return categoriesMapper.insert( categorie);
    }

    @Override
    public Integer update(Categorie categorie) {
        return categoriesMapper.updateById( categorie);
    }
}
